package com.lee.chapter01;

public class Test_Escape_Publish {
    private EventLister eventLister;

    public Test_Escape_Publish(EventLister lister) {
        String simpleName = this.getClass().getSimpleName();
        System.out.println(simpleName);
        eventLister = lister;
    }

    public void registerListener(EventLister eventLister) {
        this.eventLister = eventLister;
    }


    private interface EventLister{
        void onEvent(Event event);
    }

    private class Event{
        private String message;

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }

    public static void main(String[] args) {
        Test_Escape_Publish tep = new Test_Escape_Publish(new EventLister() {
            @Override
            public void onEvent(Event event) {
                System.out.println(event.getMessage());
            }
        });
    }
}
